package com.atguigu.gmall.product.vo;

import com.atguigu.gmall.product.entity.SpuSaleAttr;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;

/**
 * @author lfy
 * @Description 商品详情VO
 * @create 2023-07-15 11:27
 */
@Data
public class ItemDataVo {

    // sku的分类层级：封装 当前 sku 所属的具体分类层级
    private CategoryViewVo categoryView;
    // sku的基本信息：名字、id、重量、图片
    private SkuInfoVo skuInfo = new SkuInfoVo();
    // sku的价格，实时最新价格
    private BigDecimal price;

    // spu销售属性列表
    private List<SpuSaleAttr> spuSaleAttrList;

    // 保存每个商品的组合是什么，方便前端点击一种组合以后，直接跳转到指定商品
    // { "119|122":"49" , "118|123":"50" , "120|123":"51" }
    // 前端点了这个组合  "118|123"；
    private String valuesSkuJson;


    @Data
    public static class CategoryViewVo {
        private Long category1Id;
        private Long category2Id;
        private Long category3Id;
        private String category1Name;
        private String category2Name;
        private String category3Name;

    }

    @Data
    public static class SkuInfoVo{
        private Long id; //skuId
        private Long spuId;
        private String skuDefaultImg;
        private String skuName;
        private BigDecimal weight;
        private List<SkuImageVo> skuImageList;
    }

    @Data
    public static class SkuImageVo{
        private String imgUrl;
    }

    @Data
    public static class SpuSaleAttrVo{
        private Long id;
        private String saleAttrName;
        private Long index;
        private List<SpuSaleAttrValueVo> spuSaleAttrValueList; //销售属性值集合
    }

    @Data
    public static class SpuSaleAttrValueVo{
        private Long id;
        private String saleAttrValueName;
        private Integer isChecked;

    }
}

